package com.lavida.project.system.attendance.mapper;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.graphbuilder.math.func.RandFunction;
import com.lavida.project.system.accumulation.domain.Accumulation;

import org.apache.ibatis.annotations.Select;

import com.lavida.project.system.attendance.domain.Attendances;
import com.lavida.project.system.attendance.domain.Attendancess;

public interface AttendancessMapper {
	
	List<Attendancess> selectAttendancessm(Attendancess attendancess,@Param("fromtime") String fromtime,@Param("totime") String totime);

	List<Attendancess> selectAttendancessms(@Param("job_id")String job_id,@Param("dates")String dates);
	
	long insertAttendancessm(Attendancess attendancess);
	
	/**
	 * 查找本年度某月总工时
	 * @param month
	 * @return
	 */
	@Select("SELECT SUM(worktime) FROM attendancess WHERE YEAR = YEAR(CURDATE()) AND MONTH = #{month}")
	public Double getSumWorkTime(String month);
	
	/**
	 * 查找本年度某月请假工时
	 * @param month
	 * @return
	 */
	@Select("SELECT SUM(review+sick+shijia) FROM attendancess WHERE YEAR = YEAR(CURDATE()) AND MONTH = #{month}")
	public Double getSumLeaveTime(String month);
	
	/**
	 * 查找本年度某月加班工时
	 * @param month
	 * @return
	 */
	@Select("SELECT SUM(workg+workx+workj) FROM attendancess WHERE YEAR = YEAR(CURDATE()) AND MONTH = #{month}")
	public Double getSumOverTime(String month);
	
	long insertAttendancessms(Attendancess attendancess);
	
	long updateAttendancessm(Attendancess attendancess); 
	
	long updateAttendancessms(Attendancess attendancess); 
	
	Attendancess AttendancessById(String job_id);
	
	Attendancess AttendancessmById(Integer job_id);
	
}
